import request from "@/utils/request.js";

export function computeRange(data){
  return request.get('productSaleConfig/computeRange?price='+data,{noAuth:true});
}

export function isPhotos(id){
  return request.get(`order/isPhotos?seckillId=${id}`,{noAuth:true});
}

export function getCartCounts(numType,type) {
	return request.get("cart/count?numType=" + numType + "&type=" + type);
}

export function getCartList(data) {
	return request.get("cart/list", data);
}

export function changeCartNum(cartId, number) {
	return request.post("cart/num", {
		id: cartId,
		number: number
	}, {}, 1);
}
export function cartDel(ids) {
	if (typeof ids === 'object')
		ids = ids.join(',');
	return request.post('cart/delete', {
		ids: ids
	}, {}, 1);
}

export function getResetCart(data) {
	return request.post('cart/resetcart', data);
}

export function getOrderList(data) {
	return request.get('order/list', data);
}

export function orderProduct(data) {
	return request.post('order/product', data);
}

export function orderComment(data) {
	return request.post('order/comment', data);
}

export function orderPay(data) {
	return request.post('order/pay', data);
}

export function orderData() {
	return request.get('order/data')
}

export function orderCancel(id) {
	return request.post('order/cancel', {
		id: id
	}, {}, 1);
}

export function orderDel(uni) {
	return request.post('order/del', {
		id: uni
	}, {}, 1);
}


export function getOrderDetail(uni) {
	return request.get('order/detail/' + uni);
}

export function orderAgain(uni) {
	return request.post('order/again', {
		orderNo: uni
	});
}

export function orderTake(uni) {
	return request.post('order/take', {
		id: uni
	}, {}, 1);
}

export function express(uni) {
	return request.get("order/express/" + uni);
}


export function ordeRefundReason() {
	return request.get('order/refund/reason');
}


export function orderRefundVerify(data) {
	return request.post('order/refund', data);
}


export function orderConfirm(cartId, isNew, addAgain,secKill,combination,bargain) {
	return request.post('order/confirm', {
		cartIds: cartId,
		isNew: isNew,
		addAgain: addAgain,
		secKill: secKill,
		combination:combination,
		bargain:bargain
	});
}

export function getCouponsOrderPrice(preOrderNo) {
	return request.get(`coupons/order/${preOrderNo}`)
}

export function orderCreate(data) {
	return request.post('order/create', data);
}


export function postOrderComputed(data) {
	return request.post("order/computed/price", data);
}


export function qrcodeApi(data) {
	return request.post('qrcode/str2base64', data, {}, 1);
}


export function wechatOrderPay(data) {
	return request.post('pay/payment', data);
}


export function wechatQueryPayResult(data) {
	return request.get('pay/queryPayResult?orderNo=' + data);
}


export function applyRefund(orderId) {
	return request.get(`order/apply/refund/${orderId}`);
}


export function preOrderApi(data) {
	return request.post(`order/pre/order`, data);
}


export function continueState(id){
  return request.get('reservation/continuePhotos?seckillId='+id,{noAuth:true});
}


export function loadPreOrderApi(preOrderNo) {
	return request.get(`order/load/pre/${preOrderNo}`);
}